package com.qhg.saas_server.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qhg.saas_server.mapper.SupplierMapper;
import com.qhg.saas_server.pojo.Supplier;
import com.qhg.saas_server.pojo.dto.SupplierDto;
import com.qhg.saas_server.service.SupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SupplierServiceImpl implements SupplierService {

    @Autowired
    SupplierMapper supplierMapper;
    @Override
    public PageInfo SelectAll(Integer pageNum,Integer pageSize,String supName, String comploName) {
        PageHelper.startPage(pageNum,pageSize);
        List<SupplierDto> supplierDtos = supplierMapper.SelectAll(supName, comploName);
        PageInfo<SupplierDto> pageInfo = new PageInfo(supplierDtos);
        return pageInfo;
    }

    @Override
    public SupplierDto SelectById(Integer supId) {
        return supplierMapper.SelectById(supId);
    }

    @Override
    public void InsertSupplier(Supplier supplier) {
        supplierMapper.InsertSupplier(supplier);
    }

    @Override
    public void UpdateSupplier(Supplier supplier) {
        supplierMapper.UpdateSupplier(supplier);
    }

    @Override
    public void DeleteSupplier(Integer supId) {
        supplierMapper.DeleteSupplier(supId);
    }
}
